package sudoku.Vista;

import java.util.LinkedList;

/**
 * @author User
 */
public class VistaPuntaje extends javax.swing.JDialog {

    public VistaPuntaje(LinkedList<String> lista) {
        initComponents();
        setTopTen(lista);
        this.setVisible(true);
    }

    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jScrollPane1 = new javax.swing.JScrollPane();
        jtaTopTen = new javax.swing.JTextArea();
        jlTopTen = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Top Ten");

        jtaTopTen.setColumns(20);
        jtaTopTen.setEditable(false);
        jtaTopTen.setRows(5);
        jScrollPane1.setViewportView(jtaTopTen);

        jlTopTen.setFont(new java.awt.Font("Tahoma", 3, 36));
        jlTopTen.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jlTopTen.setText("Top Ten");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jlTopTen, javax.swing.GroupLayout.DEFAULT_SIZE, 390, Short.MAX_VALUE)
                .addGap(10, 10, 10))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jlTopTen)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 260, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JLabel jlTopTen;
    private javax.swing.JTextArea jtaTopTen;
    // End of variables declaration//GEN-END:variables

    private void setTopTen(LinkedList<String> lista){
        int indice = lista.size()-1;
        while(indice >= 0){
            jtaTopTen.insert((indice+1)+"--"+lista.get(indice)+"\n", WIDTH);
            indice--;
        }            
    }

}
